﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using CommonCs;
using DataServer;

namespace LogicServer
{
    public class BugTypesLogic
    {
        /// <summary>
        /// 获取所有的bug类型列表
        /// </summary>
        /// <returns></returns>
        public List<BugTypes> GetAllType()
        {
            List<BugTypes> list = new List<BugTypes>();
            BugTypeData bd = new BugTypeData();
            
            list = Common.DataTableToList<BugTypes>(bd.GetAlltypes());

            if (list == null || list.Count == 0)
            {
                return null;
            }
            return list;
        }

        /// <summary>
        /// 添加类别
        /// </summary>
        /// <param name="val">typevalue</param>
        /// <returns>boolean</returns>
        public bool AddBugType(String val)
        {
            BugTypeData bd = new BugTypeData();
            return bd.AddType(val);
        }

        /// <summary>
        /// 更新类别
        /// </summary>
        /// <param name="id">typeid</param>
        /// <param name="val">typevalue</param>
        /// <returns>boolean</returns>
        public bool EditBugType(String id,String val)
        {
            BugTypeData bd = new BugTypeData();
            return bd.UpdateType(id,val);
        }

        /// <summary>
        /// 删除bug类别
        /// </summary>
        /// <param name="id">typeid</param>
        /// <returns>boolean</returns>
        public bool DelBugType(String id)
        {
            BugTypeData bd = new BugTypeData();
            return bd.DeleteType(id);
        }
    }
}
